/**
 * Copyright (c) 2017-2024 Nop Platform. All rights reserved.
 * Author: canonical_entropy@163.com
 * Blog:   https://www.zhihu.com/people/canonical-entropy
 * Gitee:  https://gitee.com/canonical-entropy/nop-entropy
 * Github: https://github.com/entropy-cloud/nop-entropy
 */
package com.gitee.wsl.func.select.evaluator

import com.gitee.wsl.func.select.IMatchEvaluator

class NotEvaluator<E, C>(
    private val evaluator: IMatchEvaluator<E, C>
) : IMatchEvaluator<E, C> {

    override fun matches(element: E, context: C): Boolean {
        return !evaluator.matches(element, context)
    }

    override fun toString(): String {
        return "not($evaluator)"
    }
}